//
//  KATMath.h
//  KATFramework
//
//  Created by Kantice on 16/3/27.
//  Copyright © 2016年 KatApp. All rights reserved.
//  数学公式

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface KATMath : NSObject


#define MATH_FIBONACCI 0.6180339887
#define MATH_EARTH_RADIUS 6378.137




#pragma -mark 几何


///矩形周长
+ (double)perimeterOfRectWithWidth:(double)width height:(double)height;

///矩形面积
+ (double)areaOfRectWithWidth:(double)width height:(double)height;

///三角形周长
+ (double)perimeterOfTriangleWithLengthA:(double)a lengthB:(double)b lengthC:(double)c;

///三角形面积
+ (double)areaOfTriangleWithBottomWidth:(double)width height:(double)height;

///圆形周长
+ (double)perimeterOfCircleWithRadius:(double)radius;

///圆形面积
+ (double)areaOfCircleWithRadius:(double)radius;

///计算两点间的距离
+ (double)distanceWithPointA:(CGPoint)pa andPointB:(CGPoint)pb;

///已知三角形3边(a,b,c)长度，计算其中一边a对应的夹角A（余弦定理）
+ (double)angleAWithSideA:(double)a sideB:(double)b sideC:(double)c;

///已知三角形3边(a,b,c)长度，计算其中一边b对应的夹角B（余弦定理）
+ (double)angleAWithSideB:(double)a sideB:(double)b sideC:(double)c;

///已知三角形3边(a,b,c)长度，计算其中一边c对应的夹角C（余弦定理）
+ (double)angleAWithSideC:(double)a sideB:(double)b sideC:(double)c;

///已知两边和夹角，求另一边
+ (double)sideCWithAngle:(double)angle sideA:(double)a sideB:(double)b;

///已知边长和外接圆半径，计算角度（正弦定理）
+ (double)angelWithSide:(double)side andRadius:(double)radius;

///已知角度和外接圆半径，计算边长（正弦定理）
+ (double)sidelWithAngle:(double)angle andRadius:(double)radius;


#pragma -mark 代数

///等差数列求和（已经知首数、末数和项数）
+ (double)sumOfArithmeticSequenceWithFirstNumber:(double)first andLastNumber:(double)last andCount:(long)count;

///等差数列求和（已经知首数、差和项数）
+ (double)sumOfArithmeticSequenceWithFirstNumber:(double)first andDifference:(double)dif andCount:(long)count;

///等比数列求和（已经知首数、末数和项数）
+ (double)sumOfGeometricSequenceWithFirstNumber:(double)first andLastNumber:(double)last andRatio:(double)ratio;

///等比数列求和（已经知首数、比和项数）
+ (double)sumOfGeometricSequenceWithFirstNumber:(double)first andRatio:(double)ratio andCount:(long)count;

///数字阶乘
+ (long)factorialOfNumber:(long)number;

///排列
+ (long)permutationWithNumber:(long)number fromCount:(long)count;

///组合
+ (long)combinationWithNumber:(long)number fromCount:(long)count;

///斐波纳吉数
+ (long)numberOfFibonacciSequenceWithIndex:(long)index;


#pragma -mark 地理

///计算两个GPS坐标之际的直线距离(单位：千米)
+ (double)distanceWithLatitudeA:(double)latA latitudeB:(double)latB longitudeA:(double)lngA longitudeB:(double)lngB;



@end



